package com.zhijian.medical.controller;

import java.util.List;

import com.zhijian.medical.entity.vo.request.*;
import com.zhijian.medical.entity.vo.response.RoutineSingleSampleVo;
import com.zhijian.medical.service.RoutinePathologyTsSjService;
import com.zhijian.medical.service.RoutineSingleSampleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.zhijian.response.annotation.Response;

import com.zhijian.medical.service.RoutinePathologyTsService;
import com.zhijian.medical.entity.vo.response.RoutinePathologyTsVo;

import lombok.extern.slf4j.Slf4j;

/**
 * 常规病例-脱水 控制层
 * 
 * @author auto
 * @version 1.0
 * @date 2024-07-25 17:49:31
 */
@Slf4j
@Controller
@Api(tags = "常规病例-脱水")
public class RoutinePathologyTsController {

	@Autowired
    private RoutinePathologyTsService service;

    @Autowired
    private RoutinePathologyTsSjService tsSjService;

    @Autowired
    private RoutineSingleSampleService singleSampleService;

    /**
     * 输入框输入数据
     *
     * @param numbers
     * @return
     */
    @Response
    @GetMapping("/routine/pathology/ts/{numbers}")
    @ApiOperation("脱水-输入脱水框")
    public boolean inputNums(@PathVariable("numbers")String numbers) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), numbers);
        return service.inputNums(numbers);
    }

    /**
     * 获取脱水详情
     * @return
     */
    @Response
    @PostMapping("/routine/pathology/ts/info")
    @ApiOperation("获取脱水详情")
    public RoutinePathologyTsVo pathologyInfo() {
        log.info("{} | query info", this.getClass().getSimpleName());
        return service.pathologyInfo();
    }

    /**
     * 修改试剂信息
     *
     * @param id
     * @param param
     * @return
     */
    @Response
    @PutMapping("/routine/pathology/ts/sj/{id}")
    @ApiOperation("修改试剂信息")
    public boolean update(@PathVariable("id") Long id, @RequestBody RoutinePathologyTsSjSaveOrUpdateVo param) {
        log.info("{} - {}| update info, {}", this.getClass().getSimpleName(), id, param);
        param.setId(id);
        return tsSjService.modify(param);
    }

    /**
     * 列表查询
     *
     * @param nums
     * @return
     */
    @Response
    @GetMapping("/routine/single/list/{nums}")
    @ApiOperation("样本详情")
    public List<RoutineSingleSampleVo> selectList(@ApiParam(name = "nums", value = "脱水框编号") @PathVariable("nums") String nums) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), nums);
        RoutineSingleSampleSearchVo searchVo = new RoutineSingleSampleSearchVo();
        searchVo.setTsBasketCode(nums);
        return singleSampleService.selectList(searchVo);
    }

}